package com.lrkj.waitress.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.SecurityUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.waitress.mapper.RepairManageMapper;
import com.lrkj.waitress.domain.RepairManage;
import com.lrkj.waitress.service.IRepairManageService;

/**
 * 报修设置Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-03-22
 */
@Service
public class RepairManageServiceImpl implements IRepairManageService
{
    @Autowired
    private RepairManageMapper repairManageMapper;

    /**
     * 查询报修设置
     *
     * @param id 报修设置ID
     * @return 报修设置
     */
    @Override
    public RepairManage selectRepairManageById(String id)
    {
        return repairManageMapper.selectRepairManageById(id);
    }

    /**
     * 查询报修设置列表
     *
     * @param repairManage 报修设置
     * @return 报修设置
     */
    @Override
    public List<RepairManage> selectRepairManageList(RepairManage repairManage)
    {
        return repairManageMapper.selectRepairManageList(repairManage);
    }

    /**
     * 新增报修设置
     *
     * @param repairManage 报修设置
     * @return 结果
     */
    @Override
    public int insertRepairManage(RepairManage repairManage)
    {
        repairManage.setId(IdUtils.simpleUUID());
        repairManage.setCreateBy(SecurityUtils.getUsername());
        repairManage.setCreateTime(DateUtils.getNowDate());
        return repairManageMapper.insertRepairManage(repairManage);
    }

    /**
     * 修改报修设置
     *
     * @param repairManage 报修设置
     * @return 结果
     */
    @Override
    public int updateRepairManage(RepairManage repairManage)
    {
        repairManage.setUpdateBy(SecurityUtils.getUsername());
        repairManage.setUpdateTime(DateUtils.getNowDate());
        return repairManageMapper.updateRepairManage(repairManage);
    }

    /**
     * 批量删除报修设置
     *
     * @param ids 需要删除的报修设置ID
     * @return 结果
     */
    @Override
    public int deleteRepairManageByIds(String[] ids)
    {
        return repairManageMapper.deleteRepairManageByIds(ids);
    }

    /**
     * 删除报修设置信息
     *
     * @param id 报修设置ID
     * @return 结果
     */
    @Override
    public int deleteRepairManageById(String id)
    {
        return repairManageMapper.deleteRepairManageById(id);
    }
    /**
     * 批量新增报修设置信息
     *
     * @param repairManages 报修设置对象
     */
    public int batchAddData(List<RepairManage> repairManages)
    {
           return repairManageMapper.batchAddData(repairManages);
    }
}
